package com.beiding.listener;

import com.beiding.dao.OrderDao;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class UserDelete {


    private OrderDao orderDao;

    @Autowired
    public void setOrderDao(OrderDao orderDao) {
        this.orderDao = orderDao;
    }

    //如果订单在删除的时候需要其他操作,就使用MongoDB的监听器进行处理
    @RabbitListener(queues = "ua.deleteUser.async")
    public void deleteUser(String userId) {
        orderDao.deleteByHolder(userId);
    }

}
